<?php
	/**
	* Product brand - Save
	* @author trungdt
	* @since Sep 27, 2011
	* 
	* Change logs
	* 
	*/

	if (!defined('EXPONENT')) exit('');

	$band = null;
	if (isset($_POST['id'])) {
		$band = $db->selectObject('productsmodule_brand','id='.intval($_POST['id']));
		if ($band) {
			$loc = unserialize($band->location_data);
		}
	} 

	if (exponent_permissions_check(array('administrate','configure'),$loc)){
		$band = productsmodule_categories::brand_update($_POST,$band);
		$band->location_data = serialize($loc);

		if (isset($band->id)) {
			$db->updateObject($band,'productsmodule_brand');
		} else {
			$db->insertObject($band,'productsmodule_brand');
		}
		exponent_flow_redirect();
	} else {
		echo SITE_404_HTML;
	}

?>
